<template>
  <div>
    <!-- 标题区域 -->
    <div class="floor-title" v-if="floortitles != null" v-text="floortitles"></div>
    <!-- 楼层导航 不规则布局-->
    <div class="floor">
      <div class="floor-anomaly" v-if="floor1 != null">
        <div class="floor-one">
          <img :src="floor1[0].image" width="100%">
        </div>
        <div>
          <div class="floor-two">
            <img :src="floor1[1].image" width="100%">
          </div>
          <div>
            <img :src="floor1[2].image" width="100%">
          </div>
        </div>
      </div>
    </div>
    <!-- 规则布局 -->
    <div class="floor-rule" v-if="floor1 != null">
      <div v-for="(item,index) in floor1.slice(3)" :key="index+'rulef'">
        <img :src="item.image" width="100%">
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import Vue from "vue";

export default Vue.extend({
  name: "floor",
  props: ["floorData",'floorTitle'],
  data() {
    return {
      floor1: null,
      floortitles:null
    };
  },
  watch: {
    floorData: {
      immediate: true,
      deep: true,
      handler(newValue, oldValue) {
        this.floor1 = newValue;
      }
    },
    floorTitle:{
      deep:true,
      immediate: true,
      handler(val){
        this.floortitles = val
      }
    }
  }
});
</script>

<style lang="scss" scoped>
// 商品推荐
.floor-title{
  text-align: center;
  font-size: 14px;
  height: 1.8rem;
  line-height: 1.8rem
}
// 楼层导航 不规则布局
.floor {
  .floor-anomaly {
    display: flex;
    flex-direction: row;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    div {
      width: 10rem;
      box-sizing: border-box;
      -webkit-box-sizing: border-box;
    }
    .floor-one {
      border-right: 1px solid #dddddd;
    }
    .floor-two {
      border-bottom: 1px solid #dddddd;
    }
  }
}
// 规则布局
.floor-rule {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  background-color: #fff;
  div {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    width: 10rem;
    border-bottom: 1px solid #ddd;
  }
  div:nth-child(odd) {
    border-right: 1px solid #ddd;
  }
}
</style>